<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../js/vue.js"></script>
</head>

<body>
    <div id="blog-posts-events-demo">
        <div :style="{ fontSize: postFontSize + 'em' }">
            <blog-post v-for="post in posts" v-bind:key="post.id" v-bind:post="post"
                v-on:enlarge-text="postFontSize += 0.1">
            </blog-post>
            <button v-on:click="$emit('enlarge-text')">
                Enlarge text
            </button>
        </div>

    </div>
</body>
<script>
    Vue.component('blog-post', {
        props: ['post'],
        template: `
            <div class="blog-post">
            <h3>{{ post.title }}</h3>
            <button v-on:click="$emit('enlarge-text')">
                Enlarge text
            </button>
            <div v-html="post.content"></div>
            </div>
        `
    })

    new Vue({
        el: "#blog-posts-events-demo",
        Date: {
            postFontSize: 12,
        }
    })

</script>

</html>